﻿<!DOCTYPE html>
<html>
<head>
    <title>获取OpenId</title>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta name="referrer" content="never">
    <script type="text/javascript">
        function GetQueryString(name) {
            var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)");
            var r = window.location.search.substr(1).match(reg);
            if (r != null) return unescape(r[2]); return null;
        }
    </script>
</head>
<body>
    <div class="wrapper_page">
        <ul id="listNews">
        </ul>
    </div>
    <script src="http://cdn.bootcss.com/zepto/1.1.4/zepto.min.js" type="text/javascript"></script>
    <script src="asset/js/utils.js" type="text/javascript"></script>
    <script type="text/javascript">
        $(document).ready(function () {
            var openid = getCookie("myOpenId");

            $.ajax({
                url: "https://zhihu-daily.leanapp.cn/api/v1/last-stories",
                dataType: 'application/json',
                type: 'GET',
                error: function (data) {
                    alert('error');
                },
                success: function (data) {
                    var news = JSON.parse(data);

                    $(news.STORIES.stories).each(function (index, item) {

                        $("#listNews").append('<li><img src="'+ item.images[0] +'" />'+ item.title +'</li>');
                    });


                }
            });
        });
    </script>
</body>
</html>